<?php /* Smarty version Smarty-3.1.8, created on 2014-09-02 14:22:37
         compiled from "C:\wamp\www\framework\calidad\views\medicion\index.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1018753bd5dc7da1f98-53921688%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '6e02f427aed2882a80f41473620e3a06b3ea8427' => 
    array (
      0 => 'C:\\wamp\\www\\framework\\calidad\\views\\medicion\\index.tpl',
      1 => 1409667749,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1018753bd5dc7da1f98-53921688',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_53bd5dc7da4299_82588577',
  'variables' => 
  array (
    'fechaIni' => 0,
    'fechaFin' => 0,
    'lista_ordenes' => 0,
    'orden' => 0,
    'encabezados' => 0,
    'cliente' => 0,
    'count' => 0,
    'ordenes' => 0,
    'id' => 0,
    'partida' => 0,
    'medida' => 0,
    'datos' => 0,
    'resultado' => 0,
    'color' => 0,
    'texto' => 0,
    'tolMin' => 0,
    'tolMax' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_53bd5dc7da4299_82588577')) {function content_53bd5dc7da4299_82588577($_smarty_tpl) {?><?php if (!is_callable('smarty_function_html_options')) include 'C:\\wamp\\www\\framework\\libs\\Smarty\\libs\\plugins\\function.html_options.php';
if (!is_callable('smarty_function_counter')) include 'C:\\wamp\\www\\framework\\libs\\Smarty\\libs\\plugins\\function.counter.php';
?><form method="post" action="">
    <p><strong>Ver mediciones del dia <input type="date" name="fechaIni" value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['fechaIni']->value)===null||$tmp==='' ? '' : $tmp);?>
"/> al <input type="date" name="fechaFin" value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['fechaFin']->value)===null||$tmp==='' ? '' : $tmp);?>
"/></strong></p>
    <p><strong>Orden:</strong><select name="orden">
        <option value="0">Seleccione orden a buscar...</option>
        <?php echo smarty_function_html_options(array('values'=>$_smarty_tpl->tpl_vars['lista_ordenes']->value,'output'=>$_smarty_tpl->tpl_vars['lista_ordenes']->value,'selected'=>(($tmp = @$_smarty_tpl->tpl_vars['orden']->value)===null||$tmp==='' ? "0" : $tmp)),$_smarty_tpl);?>

    </select></p>
    <input type="submit" value="Buscar" name="submit"/>
</form>
    <hr />
<a href="medicion/orden/agregar">Agregar orden de trabajo</a>
<?php echo smarty_function_counter(array('start'=>1,'skip'=>1,'print'=>false,'assign'=>'count'),$_smarty_tpl);?>

<?php  $_smarty_tpl->tpl_vars['cliente'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cliente']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['encabezados']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cliente']->key => $_smarty_tpl->tpl_vars['cliente']->value){
$_smarty_tpl->tpl_vars['cliente']->_loop = true;
?>

<hr />
<h2><?php echo $_smarty_tpl->tpl_vars['cliente']->value['nombre'];?>

    <a href="#"><span onclick="ocultar_mostrar('#cliente_<?php echo $_smarty_tpl->tpl_vars['count']->value;?>
'); return false;" id="cliente_<?php echo $_smarty_tpl->tpl_vars['count']->value;?>
_signo">[+]</span></a> 
</h2>

<hr />
<div id="cliente_<?php echo $_smarty_tpl->tpl_vars['count']->value;?>
" style="display:none; overflow: auto;"> 

<?php  $_smarty_tpl->tpl_vars['ordenes'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['ordenes']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cliente']->value['ordenes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['ordenes']->key => $_smarty_tpl->tpl_vars['ordenes']->value){
$_smarty_tpl->tpl_vars['ordenes']->_loop = true;
?>
<?php $_smarty_tpl->tpl_vars['id'] = new Smarty_variable((((($_smarty_tpl->tpl_vars['ordenes']->value['no_parte']).("-")).($_smarty_tpl->tpl_vars['ordenes']->value['orden'])).("-")).($_smarty_tpl->tpl_vars['ordenes']->value['operacion']), null, 0);?>
    <table id="<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
">
        <tr>
            <th>NO PARTE</th>
            <th>ORDEN</th>
            <th>OPERACION</th>
            <th>MAQUINA</th>
            <th><a id="editar" href="medicion/orden/editar/<?php echo $_smarty_tpl->tpl_vars['ordenes']->value['folio'];?>
">Editar</a></th>
        </tr>
        <tr>
            <td><?php echo $_smarty_tpl->tpl_vars['ordenes']->value['no_parte'];?>
</td>
            <td><?php echo $_smarty_tpl->tpl_vars['ordenes']->value['orden'];?>
</td>
            <td><?php echo $_smarty_tpl->tpl_vars['ordenes']->value['operacion'];?>
</td>
            <td><?php echo $_smarty_tpl->tpl_vars['ordenes']->value['maquina'];?>
</td>
            <th><a href="medicion/verificacion/agregar/<?php echo $_smarty_tpl->tpl_vars['ordenes']->value['orden'];?>
">Agregar</a></th>
        </tr>
        <tr id="fecha">
            <th colspan="4"><strong>Fecha</strong></th>
        </tr>
        <tr id="tipo">
            <th colspan="4"><strong>Tipo</strong></th>
        </tr>
        <tr id="insp">
            <th colspan="4"><strong>Inspector</strong></th>
        </tr>
        <tr id="resultados">
            <th>Medida</th>
            <th>maximo</th>
            <th>minimo</th>
            <th>nominal</th>
        </tr>
    </table>
    <hr />
    
    <script type="text/javascript">
        <?php  $_smarty_tpl->tpl_vars['partida'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['partida']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['ordenes']->value['partidas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['partida']->key => $_smarty_tpl->tpl_vars['partida']->value){
$_smarty_tpl->tpl_vars['partida']->_loop = true;
?>
            $('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #fecha').append('<td><?php echo (($tmp = @$_smarty_tpl->tpl_vars['partida']->value['fecha'])===null||$tmp==='' ? '' : $tmp);?>
</td>');
                $('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #tipo').append('<td><?php echo (($tmp = @$_smarty_tpl->tpl_vars['partida']->value['nombre'])===null||$tmp==='' ? '' : $tmp);?>
</td>');
                $('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #insp').append('<td><?php echo (($tmp = @$_smarty_tpl->tpl_vars['partida']->value['usuario'])===null||$tmp==='' ? '' : $tmp);?>
</td>');
                <?php if ($_smarty_tpl->tpl_vars['partida']->value['partida']!=''){?>                
                $('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #resultados').append('<th><a href="verificacion/editar/<?php echo $_smarty_tpl->tpl_vars['partida']->value['partida'];?>
">Editar</a></th>');
                <?php }?>                
            <?php  $_smarty_tpl->tpl_vars['medida'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['medida']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['ordenes']->value['medidas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['medida']->key => $_smarty_tpl->tpl_vars['medida']->value){
$_smarty_tpl->tpl_vars['medida']->_loop = true;
?>
                <?php $_smarty_tpl->tpl_vars['resultado'] = new Smarty_variable((($tmp = @$_smarty_tpl->tpl_vars['datos']->value[$_smarty_tpl->tpl_vars['partida']->value['partida']][$_smarty_tpl->tpl_vars['medida']->value['id']]['medida'])===null||$tmp==='' ? "N/A" : $tmp), null, 0);?>
                <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('white', null, 0);?>
                <?php $_smarty_tpl->tpl_vars['texto'] = new Smarty_variable('black', null, 0);?>
                
                <?php if ($_smarty_tpl->tpl_vars['medida']->value['atributo']==1){?>
                    <?php if ($_smarty_tpl->tpl_vars['resultado']->value==0){?>
                        <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('red', null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['texto'] = new Smarty_variable('white', null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['resultado'] = new Smarty_variable('NO OK', null, 0);?>
                    <?php }else{ ?>
                        <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('lightgreen', null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['resultado'] = new Smarty_variable('OK', null, 0);?>
                    <?php }?>
                    
                    if(!$('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #medida<?php echo $_smarty_tpl->tpl_vars['medida']->value['id'];?>
').length)$('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
').append('<tr background-color: <?php echo $_smarty_tpl->tpl_vars['color']->value;?>
; color: <?php echo $_smarty_tpl->tpl_vars['texto']->value;?>
 id="medida<?php echo $_smarty_tpl->tpl_vars['medida']->value['id'];?>
"><th colspan="3"><?php echo $_smarty_tpl->tpl_vars['medida']->value['nombre'];?>
</th><th>OK</th></tr>');
                    $('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #editar').attr('style','display: none;');
                <?php }else{ ?>
                    <?php $_smarty_tpl->tpl_vars['tolMax'] = new Smarty_variable($_smarty_tpl->tpl_vars['medida']->value['max']-$_smarty_tpl->tpl_vars['medida']->value['nominal'], null, 0);?>
                    <?php $_smarty_tpl->tpl_vars['tolMin'] = new Smarty_variable($_smarty_tpl->tpl_vars['medida']->value['nominal']-$_smarty_tpl->tpl_vars['medida']->value['min'], null, 0);?>
                    
                    <?php if ($_smarty_tpl->tpl_vars['resultado']->value>=$_smarty_tpl->tpl_vars['medida']->value['nominal']-($_smarty_tpl->tpl_vars['tolMin']->value*0.6)&&$_smarty_tpl->tpl_vars['resultado']->value<=$_smarty_tpl->tpl_vars['medida']->value['nominal']+($_smarty_tpl->tpl_vars['tolMax']->value*0.6)){?>
                        <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('lightgreen', null, 0);?>
                    <?php }elseif($_smarty_tpl->tpl_vars['resultado']->value>=$_smarty_tpl->tpl_vars['medida']->value['nominal']-($_smarty_tpl->tpl_vars['tolMin']->value*0.9)&&$_smarty_tpl->tpl_vars['resultado']->value<=$_smarty_tpl->tpl_vars['medida']->value['nominal']+($_smarty_tpl->tpl_vars['tolMax']->value*0.9)){?>
                        <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('yellow', null, 0);?>
                    <?php }elseif($_smarty_tpl->tpl_vars['resultado']->value>=$_smarty_tpl->tpl_vars['medida']->value['nominal']-$_smarty_tpl->tpl_vars['tolMin']->value&&$_smarty_tpl->tpl_vars['resultado']->value<=$_smarty_tpl->tpl_vars['medida']->value['nominal']+$_smarty_tpl->tpl_vars['tolMax']->value){?>
                        <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('rgb(253, 162, 0)', null, 0);?>
                    <?php }else{ ?>
                        <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('red', null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['texto'] = new Smarty_variable('white', null, 0);?>
                    <?php }?>
                    <?php if ($_smarty_tpl->tpl_vars['resultado']->value=='N/A'){?>
                        <?php $_smarty_tpl->tpl_vars['color'] = new Smarty_variable('white', null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['texto'] = new Smarty_variable('black', null, 0);?>
                    <?php }?>
                    
                    if(!$('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #medida<?php echo $_smarty_tpl->tpl_vars['medida']->value['id'];?>
').length)$('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
').append('<tr id="medida<?php echo $_smarty_tpl->tpl_vars['medida']->value['id'];?>
"><th><?php echo $_smarty_tpl->tpl_vars['medida']->value['nombre'];?>
</th><th><?php echo $_smarty_tpl->tpl_vars['medida']->value['min'];?>
</th><th><?php echo $_smarty_tpl->tpl_vars['medida']->value['max'];?>
</th><th><?php echo $_smarty_tpl->tpl_vars['medida']->value['nominal'];?>
</th></tr>');
                <?php }?>
                
                $('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
 #medida<?php echo $_smarty_tpl->tpl_vars['medida']->value['id'];?>
').append('<td style="background-color: <?php echo $_smarty_tpl->tpl_vars['color']->value;?>
; color: <?php echo $_smarty_tpl->tpl_vars['texto']->value;?>
" ><?php echo $_smarty_tpl->tpl_vars['resultado']->value;?>
</td>');
                
            <?php } ?>
        <?php } ?>
    </script>
    
<?php } ?>
</div>
<?php echo smarty_function_counter(array('print'=>false),$_smarty_tpl);?>

<?php } ?><?php }} ?>